import React, {Component} from 'react';
import {Empty } from 'antd';
import Card from "./card";

class CardList extends Component {
    constructor(props) {
        super(props);
        this.state = {
            cardList: [
                // {
                //     serviceName: "[自营品牌] 豪华猫咪VIP房间",
                //     roomInfoVos: [
                //         {
                //             roomName: "001房",
                //             hotelHomeStatus: '',
                //             roomStatus: 0, //空房
                //             beginTime: "2023-03-01",
                //             endTime: "2023-04-30"
                //         },
                //         {
                //             roomName: "002房",
                //             hotelHomeStatus: '',
                //             roomStatus: 1, //保留
                //             beginTime: "2023-03-01",
                //             endTime: "2023-04-30"
                //         },
                //         {
                //             roomName: "003房",
                //             hotelHomeStatus: '',
                //             roomStatus:2, //脏房
                //             beginTime: "2023-03-01",
                //             endTime: "2023-04-30"
                //         },
                //         {
                //             roomName: "004房",
                //             hotelHomeStatus: '',
                //             roomStatus:3, //维修
                //             beginTime: "2023-03-01",
                //             endTime: "2023-04-30"
                //         },
                //         {
                //             roomName: "005房",
                //             hotelHomeStatus:4, //预定
                //             roomStatus:'',
                //             beginTime: "2023-03-01",
                //             endTime: "2023-04-30"
                //         },
                //         {
                //             roomName: "006房",
                //             roomStatus:'',
                //             hotelHomeStatus:5, //入住
                //             beginTime: "2023-03-01",
                //             endTime: "2023-04-30"
                //         },
                //     ]
                // }
            ],
        }
    }

    componentDidMount() {
        // console.log(this.props.data)
    }

    init = (v) => {
        // console.log("5", v)
        this.setState({
            cardList: [],
        }, () => {
            this.setState({
                cardList: v,
            })
        })
    }

    refresh = () => {
        this.props.refresh()
    }

    render() {
        let {cardList, loading} = this.state;
        let {colorOption} = this.props;
        return (
            <div className='p-layout-box card-wrap'>
                {
                    cardList.map((item, index) => {
                        return <div key={index} style={{marginBottom: "15px"}}>
                            <p><b>{item.serviceName}</b></p>
                            <Card refresh={this.refresh} colorOption={colorOption} data={item.roomInfoVos}/>
                        </div>
                    })
                }
                {
                    cardList.length ===0 ?<Empty className={"card-list-Empty"} image={Empty.PRESENTED_IMAGE_SIMPLE} />:[]
                }
            </div>
        );
    }
}

export default CardList;
